#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：pythonProject2 
@File    ：heroList.py
@Author  ：beibei
@Date    ：2024/3/26 2:32 PM 
'''
import requests
from bs4 import BeautifulSoup
def fetch_lol_heroes(url):
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()
        heroes = data.get('hero', [])

        for hero in heroes:
           hero_id = hero.get('heroId')
           hero_name = hero.get('name')
           print(
              f"hero_id:{hero_id},hero_Name:{hero_name}"
           )


fetch_lol_heroes('https://game.gtimg.cn/images/lol/act/img/js/heroList/hero_list.js?v=20')

